package h.d.bluetooth.visitor.common;

import java.util.ArrayList;
import java.util.List;

import android.os.Handler;
import android.os.Message;

/**
 * @author hdeom
 * @date 2014. 1. 15.
 *
 */
public class BluetoothHandler {
	protected static List<Handler> clients = new ArrayList<Handler>();

	static public void registerClient(Handler client) {
		if(!clients.contains(client)) {
			clients.add(client);
		}
	}

	static public void unregisterClient(Handler client) {
		while(clients.contains(client)) {
			clients.remove(client);
		}
	}

	public static void sendMessage(Message msg){
		for (Handler client : clients) {
			client.sendMessage(msg);
		}
	}


}
